//
//  UseTimelineView.swift
//  learn-ios
//
//  Created by Dong on 2022/4/6.
//

import SwiftUI

struct UseTimelineView: View {
    var body: some View {
        
        // 使用时间线视图可以轻易实现时钟功能
        TimelineView(.periodic(from: Date.now, by: 1)){ context in
            Text("\(context.date.formatted(.iso8601))")
            
        }
    }
}

struct UseTimelineView_Previews: PreviewProvider {
    static var previews: some View {
        UseTimelineView()
    }
}
